﻿using Gx.Bll.Manage;
using Gx.ColdWarehouseErp.Controllers;
using Gx.Model.Entity;
using Gx.Model.ViewModel;
using System.Linq;
using System.Web.Mvc;
namespace Gx.ZhiChengXianWei.Controllers
{
    public class LKIncidentalsController : BaseController
    {
        protected LKIncidentalsBll lKIncidentalsBll = new LKIncidentalsBll();
        //
        // GET: /LKIncidentals/

        public ActionResult List()
        {
            return View();
        }
        
        ///// <summary>
        ///// 分页列表
        ///// </summary>
        ///// <param name="customerInput"></param>
        ///// <returns></returns>
        //public JsonResult GetLKIncidentalsPageList(LKIncidentalsInput input)
        //{
        //    var result = lKIncidentalsBll.GetLKIncidentalsPageList(input);
        //    return JsonList(result.Total, result.List.ToArray());
        //}


        /// <summary>
        /// 获取杂费设置
        /// </summary>
        /// <returns></returns>
        public JsonResult GetLKIncidentals()
        {
            var result = lKIncidentalsBll.GetLKIncidentalss();
            return Json(result, JsonRequestBehavior.AllowGet);
        }

        /// <summary>
        /// 新增杂费设置
        /// </summary>
        /// <param name="lKIncidentals"></param>
        /// <returns></returns>
        public JsonResult AddLKIncidentals(LKIncidentals lKIncidentals)
        {
            var result = lKIncidentalsBll.AddLKIncidentals(lKIncidentals);
            //string message = result ? "新增成功" : "新增失败";
            return Json(result.Success, result.Msg);
        }

        /// <summary>
        /// 编辑杂费设置
        /// </summary>
        /// <param name="lKIncidentals"></param>
        /// <returns></returns>
        public JsonResult EditLKIncidentals(LKIncidentals lKIncidentals)
        {
            var result = lKIncidentalsBll.EditLKIncidentals(lKIncidentals);
            string message = result ? "编辑成功" : "编辑失败";
            return Json(result, message);
        }

        /// <summary>
        /// 删除杂费设置
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult DeleteLKIncidentals(int id)
        {
            var result = lKIncidentalsBll.DeleteLKIncidentals(id);
            string message = result ? "删除成功" : "删除失败";
            return Json(result, message);
        }
    }
}

